﻿<customWindow:BlackStyleChildWindow xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
           xmlns:chartingToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  
           x:Class="MediaBrowserSL.RIA.Views.ChildWindowSettings"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:customWindow="http://www.sebastien-alves.fr/jadeToolsSLWindows"   
           xmlns:jadeControls="http://www.sebastien-alves.fr/jadeToolsSLControls" 
           Width="640" Height="480" 
           Title="Serveur">

    <customWindow:BlackStyleChildWindow.DataContext>
        <Binding Mode="OneWay" Path="Settings" Source="{StaticResource Locator}"/>
    </customWindow:BlackStyleChildWindow.DataContext>

    <customWindow:BlackStyleChildWindow.Resources>

        <Style x:Key="ChartStyle" TargetType="chartingToolkit:Chart">
            <Setter Property="Background" Value="Transparent"/>
        </Style>

        <Style x:Key="TitleStyle" TargetType="chartingToolkit:Title">
            <Setter Property="Foreground" Value="WhiteSmoke"/>
        </Style>

        <LinearGradientBrush x:Key="MallowBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF65466C" Offset="0.364"/>
            <GradientStop Color="#FF5F1672" Offset="0.604"/>
            <GradientStop Color="#FFD0A0D6"/>
            <GradientStop Color="#FF90369D" Offset="1"/>
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="BlueBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF535676" Offset="0.364"/>
            <GradientStop Color="#FF2F3278" Offset="0.604"/>
            <GradientStop Color="#FFA0A2D6"/>
            <GradientStop Color="#FF363F9D" Offset="1"/>
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="RedBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF765353" Offset="0.364"/>
            <GradientStop Color="#FF782F2F" Offset="0.604"/>
            <GradientStop Color="#FFD6A0A0"/>
            <GradientStop Color="#FF9D3636" Offset="1"/>
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="GreenBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF537664" Offset="0.364"/>
            <GradientStop Color="#FF2F784F" Offset="0.604"/>
            <GradientStop Color="#FFA0D6BF"/>
            <GradientStop Color="#FF369D41" Offset="1"/>
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="YellowBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF737653" Offset="0.364"/>
            <GradientStop Color="#FF74782F" Offset="0.607"/>
            <GradientStop Color="#FFD6D4A0"/>
            <GradientStop Color="#FF989D36" Offset="1"/>
        </LinearGradientBrush>


        <ControlTemplate x:Key="GrowPieDataPoint" TargetType="chartingToolkit:PieDataPoint">
            <Path Data="{TemplateBinding Geometry}" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" RenderTransformOrigin="0.5,0.5">
                <Path.RenderTransform>
                    <ScaleTransform x:Name="Scale" ScaleX="0" ScaleY="0"/>
                </Path.RenderTransform>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="RevealStates">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0:0:1"/>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="Shown">
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="Scale" Storyboard.TargetProperty="ScaleX" To="1" Duration="0"/>
                                <DoubleAnimation Storyboard.TargetName="Scale" Storyboard.TargetProperty="ScaleY" To="1" Duration="0"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Hidden">
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="Scale" Storyboard.TargetProperty="ScaleX" To="0" Duration="0"/>
                                <DoubleAnimation Storyboard.TargetName="Scale" Storyboard.TargetProperty="ScaleY" To="0" Duration="0"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <ToolTipService.ToolTip>
                    <ContentControl Content="{TemplateBinding IndependentValue}"/>
                </ToolTipService.ToolTip>
            </Path>
        </ControlTemplate>

        <chartingToolkit:ResourceDictionaryCollection x:Key="GrowPieDataPointPalette">
            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="chartingToolkit:PieDataPoint">
                    <Setter Property="Template" Value="{StaticResource GrowPieDataPoint}"/>
                    <Setter Property="Background" Value="{StaticResource BlueBrush}"/>
                </Style>
            </ResourceDictionary>
            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="chartingToolkit:PieDataPoint">
                    <Setter Property="Template" Value="{StaticResource GrowPieDataPoint}"/>
                    <Setter Property="Background" Value="{StaticResource MallowBrush}"/>
                </Style>
            </ResourceDictionary>
            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="chartingToolkit:PieDataPoint">
                    <Setter Property="Template" Value="{StaticResource GrowPieDataPoint}"/>
                    <Setter Property="Background" Value="{StaticResource RedBrush}"/>
                </Style>
            </ResourceDictionary>
            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="chartingToolkit:PieDataPoint">
                    <Setter Property="Template" Value="{StaticResource GrowPieDataPoint}"/>
                    <Setter Property="Background" Value="{StaticResource GreenBrush}"/>
                </Style>
            </ResourceDictionary>
            <ResourceDictionary>
                <Style x:Key="DataPointStyle" TargetType="chartingToolkit:PieDataPoint">
                    <Setter Property="Template" Value="{StaticResource GrowPieDataPoint}"/>
                    <Setter Property="Background" Value="{StaticResource YellowBrush}"/>
                </Style>
            </ResourceDictionary>
        </chartingToolkit:ResourceDictionaryCollection>


    </customWindow:BlackStyleChildWindow.Resources>

    <Grid Background="{StaticResource BackgroundCustom}">

        <chartingToolkit:Chart x:Name="TypicalChart" VerticalAlignment="Top" Height="470" 
                           Palette="{StaticResource GrowPieDataPointPalette}" Title="Capacité serveur"
                           Style="{StaticResource ChartStyle}" TitleStyle="{StaticResource TitleStyle}">
            <chartingToolkit:Chart.Series>
                <chartingToolkit:PieSeries Margin="0,0,20,20" Title="Espace Serveur" Foreground="Black" IndependentValueBinding="{Binding Path=FormatPartName}"
                    DependentValueBinding="{Binding Path=Size}" ItemsSource="{Binding ServerSpaces}" AnimationSequence="FirstToLast" >
                    <ToolTipService.ToolTip>
                        <StackPanel>
                            <ContentControl Content="Custom ToolTip" FontWeight="Bold"/>
                        </StackPanel>
                    </ToolTipService.ToolTip>
                </chartingToolkit:PieSeries>
            </chartingToolkit:Chart.Series>
        </chartingToolkit:Chart>

        <jadeControls:Loading IsLoading="{Binding IsGetting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>

    </Grid>
</customWindow:BlackStyleChildWindow>